package com.kalaqia.image.sample;

import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;

import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader;

import net.idik.lib.slimadapter.SlimAdapter;
import net.idik.lib.slimadapter.SlimAdapterEx;
import net.idik.lib.slimadapter.SlimInjector;
import net.idik.lib.slimadapter.viewinjector.IViewInjector;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        RecyclerView mRecyclerView = findViewById(R.id.id_recycler_view);
        final List<String> lists = new ArrayList<>();

        SlimAdapter adapter = SlimAdapter.create(SlimAdapterEx.class)
                .register(R.layout.item_demo, new SlimInjector<String>() {
                    @Override
                    public void onInject(@NonNull String s, @NonNull IViewInjector injector) {
                        injector.text(R.id.id_item_demo_text, s);
                    }
                })
                .updateData(lists)
                .attachTo(mRecyclerView);

        for (int i = 0; i < 10; i++) {
            lists.add(String.valueOf(i));
        }

        adapter.notifyDataSetChanged();

//        RecyclerViewPreloader<String> preLoader =
//
//                new RecyclerViewPreloader<String>(this,)


    }


}
